import 'reflect-metadata';

export function Inject(token: string): ParameterDecorator {
  // target - 装饰构造器是类本身，装饰参数时是类原型
  return (target: any, propertyKey: string | symbol, parameterIndex: number) => {
    const existingInjectedTokens = Reflect.getMetadata('injectedTokens', target) || [];
    existingInjectedTokens[parameterIndex] = token;
    Reflect.defineMetadata('injectedTokens', existingInjectedTokens, target);
  };
}
